package com.factory.getaway;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import reactor.core.publisher.Mono;

@SpringBootApplication
@EnableDiscoveryClient
public class GetawayApplication {

    public static void main(String[] args) {
        SpringApplication.run(GetawayApplication.class,args);
    }

//    @Bean
//    public RouteLocator routes(RouteLocatorBuilder builder) {
//        return builder.routes()
//                .route("factory_rest", r ->
//                    r.path("/rest/**")
//                    .filters(f -> f.rewritePath("/rest/(?<segment>.*)","/rest/$\\{segment}"))
//                    .uri("lb://rest"))
//                .route("factory_aiclient", r ->
//                        r.path("/aiclient/**")
//                                .filters(f -> f.rewritePath("/rest/(?<segment>.*)","/aiclient/$\\{segment}"))
//                                .uri("lb://aiclient"))
//                .route("factory_manager", r ->
//                        r.path("/manager/**")
//                                .filters(f -> f.rewritePath("/rest/(?<segment>.*)","/manager/$\\{segment}"))
//                                .uri("lb://manager"))
//                .build();
//
//    }
}
